using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace LabyrinthProject
{
    class Node
    {
        private double value;

        private Vector2 position;

        private Node leftNode;
        private Node rightNode;
        private Node topNode;
        private Node bottomNode;

        private PathElement horizontalPathElement;
        private PathElement verticalPathElement;

        public double Value
        {
            get
            {
                return this.value;
            }
            set
            {
                this.value = value;
            }
        }
        public Vector2 Position
        {
            get
            {
                return position;
            }
            set
            {
                position = value;
            }
        }
        public Node LeftNode
        {
            get
            {
                return leftNode;
            }
            set
            {
                leftNode = value;
            }
        }
        public Node RightNode
        {
            get
            {
                return rightNode;
            }
            set
            {
                rightNode = value;
            }
        }
        public Node TopNode
        {
            get
            {
                return topNode;
            }
            set
            {
                topNode = value;
            }
        }
        public Node BottomNode
        {
            get
            {
                return bottomNode;
            }
            set
            {
                bottomNode = value;
            }
        }
        public PathElement HorizontalPathElement
        {
            get
            {
                return horizontalPathElement;
            }
            set
            {
                horizontalPathElement = value;
            }
        }
        public PathElement VerticalPathElement
        {
            get
            {
                return verticalPathElement;
            }
            set
            {
                verticalPathElement = value;
            }
        }
        public List<Node> ListOfNeighborNodes()
        {
            List<Node> listOfNeighborNodes = new List<Node>();

            if (leftNode != null)
                listOfNeighborNodes.Add(leftNode);
            if (rightNode != null)
                listOfNeighborNodes.Add(rightNode);
            if (topNode != null)
                listOfNeighborNodes.Add(topNode);
            if (bottomNode != null)
                listOfNeighborNodes.Add(bottomNode);

            return listOfNeighborNodes;
        }
        public List<PathElement> ListOfNeighborPathElements()
        {
            List<PathElement> listOfNeighborPathElements = new List<PathElement>();

            if (horizontalPathElement != null)
                listOfNeighborPathElements.Add(horizontalPathElement);
            if (verticalPathElement != null)
                listOfNeighborPathElements.Add(verticalPathElement);

            return listOfNeighborPathElements;
        }

        public Node( Vector2 position, PathElement horizontalPathElement, PathElement verticalPathElement )
        {
            this.position = position;
            this.horizontalPathElement = horizontalPathElement;
            this.verticalPathElement = verticalPathElement;
            this.value = 0;
        }
    }
}
